﻿using BusinessLogic.BusinessEntity.Entities;

namespace BusinessLogic.Mappers.AccountCode.Mapping
{
	internal class AccountMapping : IMapping<Account, DataControl.Account>
	{
		public Account ToBE(DataControl.Account from)
		{
			var to = new Account();

			to.Balance = from.Balance;
			to.ID = from.ID;
			to.Number = from.Number;
			to.Accountee = new BusinessEntity.Entities.User {ID = from.AccounteeFK};
			to.Currency = new BusinessEntity.Entities.Currency {ID = from.CurrencyFK};

			return to;
		}

		public DataControl.Account ToDTO(Account from)
		{
			var to = new DataControl.Account();

			to.Balance = from.Balance;
			to.ID = from.ID;
			to.Number = from.Number;
			to.AccounteeFK = from.Accountee.ID;
			to.CurrencyFK = from.Currency.ID;

			return to;
		}
	}
}
